package com.ruoyi.project.system.orderteamorder.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.system.orderteamorder.domain.OrderTeamOrder;
import com.ruoyi.project.system.orderteamorder.domain.OrderTeamOrderDto;
import com.ruoyi.project.system.orderteamorder.mapper.OrderTeamOrderMapper;
import com.ruoyi.project.system.orderteamorder.service.IOrderTeamOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 拼团订单Service业务层处理
 * 
 * @author f_baisi
 * @date 2021-03-03
 */
@Service
public class OrderTeamOrderServiceImpl implements IOrderTeamOrderService 
{
    @Autowired
    private OrderTeamOrderMapper orderTeamOrderMapper;

    /**
     * 查询拼团订单
     * 
     * @param id 拼团订单ID
     * @return 拼团订单
     */
    @Override
    public OrderTeamOrder selectOrderTeamOrderById(String id)
    {
        return orderTeamOrderMapper.selectOrderTeamOrderById(id);
    }

    /**
     * 查询拼团订单列表
     * 
     * @param orderTeamOrder 拼团订单
     * @return 拼团订单
     */
    @Override
    public List<OrderTeamOrder> selectOrderTeamOrderList(OrderTeamOrder orderTeamOrder)
    {
        return orderTeamOrderMapper.selectOrderTeamOrderList(orderTeamOrder);
    }

    /**
     * 新增拼团订单
     * 
     * @param orderTeamOrder 拼团订单
     * @return 结果
     */
    @Override
    public int insertOrderTeamOrder(OrderTeamOrder orderTeamOrder)
    {
        return orderTeamOrderMapper.insertOrderTeamOrder(orderTeamOrder);
    }

    /**
     * 修改拼团订单
     * 
     * @param orderTeamOrder 拼团订单
     * @return 结果
     */
    @Override
    public int updateOrderTeamOrder(OrderTeamOrder orderTeamOrder)
    {
        orderTeamOrder.setUpdateTime(DateUtils.getNowDate());
        return orderTeamOrderMapper.updateOrderTeamOrder(orderTeamOrder);
    }

    /**
     * 删除拼团订单对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteOrderTeamOrderByIds(String ids)
    {
        return orderTeamOrderMapper.deleteOrderTeamOrderByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除拼团订单信息
     * 
     * @param id 拼团订单ID
     * @return 结果
     */
    @Override
    public int deleteOrderTeamOrderById(String id)
    {
        return orderTeamOrderMapper.deleteOrderTeamOrderById(id);
    }

    @Override
    public List<OrderTeamOrderDto> findListBySuperOId(String id) {
        return orderTeamOrderMapper.findListBySuperOId(id);
    }

    @Override
    public OrderTeamOrderDto findByOrderNo(String orderNo) {
        return orderTeamOrderMapper.findByOrderNo(orderNo);
    }

    @Override
    public List<OrderTeamOrderDto> findListByStatusAndUid(Integer[] status, String uid, Integer refund) {
        return orderTeamOrderMapper.findListByStatusAndUid(status, uid, refund);
    }

    @Override
    public OrderTeamOrderDto findByOrderId(String id) {
        return orderTeamOrderMapper.findByOrderId(id);
    }

    @Override
    public List<OrderTeamOrderDto> selectOTOList(String uid) {
        return orderTeamOrderMapper.selectOTOList(uid);
    }
}
